<!--
	로그인 창 
	작성일 : 10월 10일 
	작성자 : 이민선 
-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>장돌뱅이 ~대한민국 전통시장을 응원합니다~</title>
<style type="text/css">
	#loginWarn{margin: 10px;}
	#top_line{width:100%; height:0px; border-bottom:1px solid #bfbfbf; widows: inherit;}
	#loginForm {margin: 40px; float:left; }
	#logo{float: inherit;}
</style>
<link href="/Jangdolbaeng2/css/customer/common1.css" rel="stylesheet">
<link href="/Jangdolbaeng2/css/bootstrap.min.css" rel="stylesheet">
<link href="/Jangdolbaeng2/css/customer/common.css" rel="stylesheet">
<script src="/Jangdolbaeng2/js/jquery-1.11.1.js"></script>
<script src="/Jangdolbaeng2/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	//alert("heart");
	$('#id').focus();
	$('#loginbtn').on('click', formSubmit);
	$('#loginbtn').css('cursor', 'pointer');
});

function formSubmit() {
	var customer_id = $('#id').val();
	var password = $('#password').val();
	
	if(customer_id.length == 0){
		alert("ID를 입력해주세요.");
		customer_id.focus(); 
		return;
	}
	if(password == ""){
		alert("비밀번호를 입력해주세요.");
		password.focus();
		return;
	}
	
	$.ajax({
		url: 'login.action',
		type: 'POST',
		dataType: 'json',
		data: {customer_id: customer_id, password: password},
		success: loginOK
	});
}

function loginOK(json){
	//로그인 성공
	if(json.result){
		alert('로그인되었습니다.');
		//alert(json.customer_id);
		//alert(json.result);
		window.close();
		opener.location.href= "/Jangdolbaeng2/product/main.action";	
	}
		
	//로그인 실패
	else {
		//alert(json.customer_id);
		//alert(json.password);
		alert('ID 또는 비밀번호가 틀렸습니다.');
		$('#id').val("");
		$('#password').val("");
	}
}  
</script>
</head>
<body>
<div id="loginWarn" style="padding-left: 50px;">
	<h1><span class="glyphicon glyphicon-lock" style="color: #FF6002; "></span>&nbsp;<span style="font-size: 40pt;">Login</span></h1>
	<span style="padding-left: 70px;">회원 로그인을 하시면 쇼핑에 도움이 되는 정보와 다양한 서비스를 제공 받으실 수 있습니다.</span>
</div>
<div id="top_line"></div>

<div id="loginForm">
	<div style="padding-bottom: 30px;">
		<span style="font-size: 16pt; font-family: nanumBB;">회원 로그인</span>
	</div>
	<table>
		<tr>
			<td><img alt="아이디" src="../img/customer/fld_id.gif"></td>
			<td><input type="text" id="id" name="customer_id" size="20"></td>
			<td rowspan="2" align="center">&nbsp;<img src="../img/customer/loginbtn.gif" id="loginbtn"></td>
		</tr>
		<tr>
			<td><img alt="비밀번호" src="../img/customer/fld_pw.gif"></td>
			<td><input type="password" id="password" name="password"></td>
			<td></td>
		</tr>
	</table>
</div>
<div id="logo">
	<img alt="로고" src="../img/customer/logo3.png" width="350px">
</div>
</body>
</html>